<?php
namespace backend\modules\openapi\controllers;


use yii\web\Controller;
use common\extended\oss\Functions;
class UploadController extends Controller{
    public $enableCsrfValidation = false;
    /**
     * 上传图片
     * @date: 2016年3月21日
     * @author: chenxiaolin
     */
    public function actionUploadpic(){
        $_FILES = $_POST;
        $upload = new Functions();
        $cover = $upload->uploadPic($_FILES,'upfile','ueditor/'.date("Y", time()) . '/' . date("m", time()) . '/' . date("d", time()) . '/' . date("H", time()));
        echo json_encode($cover);
    }
    /**
     * 上传图片2
     * @date: 2016年3月21日 
     * @author: chenxiaolin
     */
    public function actionUploadfile(){
    	$upload = new Functions();
    	$cover = $upload->uploadUeditorPic(ROOT_PATH.$_POST['filepath'],$_POST['filename'],'ueditor/'.date("Y", time()) . '/' . date("m", time()) . '/' . date("d", time()) . '/' . date("H", time()));
    	echo json_encode($cover);
    }
}

